package rsj.properties;

import common.util.emailUtils.EmailUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 邮箱配置
 *
 * @author yuanqinglong
 * @since 2021/5/13 16:39
 */
@Data
@Component
@ConfigurationProperties(prefix = "email")
public class EmailProperties {

    /**
     * 邮箱账号
     */
    private String emailUsername;
    /**
     * 邮箱密码
     */
    private String emailPassword;
    /**
     * 邮箱ip
     */
    private String emailIpHost;


    @PostConstruct
    public void init(){
        EmailUtil.setMyEmailAccount(emailUsername);
        EmailUtil.setMyEmailIMAPHost(emailIpHost);
        EmailUtil.setMyEmailPassword(emailPassword);
    }
}
